//
//  DEWSearchFriendController.m
//  OtherDemo
//
//  Created by lianjie on 2018/7/25.
//  Copyright © 2018年 lianjie. All rights reserved.
//

#import "DEWSearchFriendController.h"
#import "DEWNewFriendCell.h"
@interface DEWSearchFriendController ()<UITableViewDelegate,UITableViewDataSource,UISearchBarDelegate,DEWNewFriendDelegate>
@property (nonatomic ,strong) UITableView *table;
@property (nonatomic ,strong) UISearchBar *searchBar;
///搜索结果
@property (nonatomic ,strong) NSMutableArray *personList;
@end

@implementation DEWSearchFriendController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self createView];
    
}

#pragma mark ----requestData
-(void)loadData
{
    
    
}
#pragma mark ---initView
-(void)createView
{
    [self.view addSubview:self.table];
    [self setupSearchView];
    
}

///设置搜索
- (void) setupSearchView
{
    UISearchBar *search = [[UISearchBar alloc]initWithFrame:CGRectMake(0, 0, 268, 30.0f)];
    _searchBar = search;
    _searchBar.delegate = self;
    search.placeholder = @"搜索手机号、昵称";
    
    search.backgroundColor = UIColorFromRGB(0xF1F1F1);
    
    self.navigationItem.titleView = search;
    
}
#pragma mark --searchBarDelegate
-(BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
    
    return YES;
}

#pragma mark ---关注
-(void)DEWNewFriendCell:(DEWBaseTableViewCell *)cell didCellAtIndexPath:(NSIndexPath *)indexPath
{
    
}

#pragma mark ---tableView
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return 3;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        
        UITableViewCell *signCell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"signCell"];
        
        signCell.textLabel.font = [UIFont systemFontOfSize:13.0f];
        signCell.textLabel.textColor = UIColorFromRGB(0x999999);
        signCell.textLabel.text = @"联系人";
        
        return signCell;
    }else{
        
        DEWNewFriendCell *cell = [[DEWNewFriendCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"cell"];
        
        cell.indexPath = indexPath;
        cell.delegate = self;
        cell.friendInfo = nil;
        
        return cell;
    }
    
    
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if (indexPath.row == 0) {
        return 45.0f;
    }else{
        return 75.0f;
    }
}

-(CGFloat)tableView:(UITableView *)tableView heightForFooterInSection:(NSInteger)section
{
    return 0.001f;
}
-(CGFloat)tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 0.001f;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:NO];
    
    
}

#pragma mark --lazy
-(UITableView *)table
{
    if (!_table) {
        _table = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, DEWScreenWidth, DEWScreenHeight-(NAVH)) style:UITableViewStyleGrouped];
        
        _table.delegate = self;
        
        _table.dataSource = self;
        
        _table.separatorStyle = UITableViewCellSeparatorStyleNone;
    }
    return _table;
    
}

-(NSMutableArray *)personList
{
    if (!_personList) {
        _personList = [NSMutableArray array];
        
    }
    return _personList;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
